package com.drakulo.games.ais.core.building;

import java.util.ArrayList;
import java.util.List;

import org.newdawn.slick.Input;

public enum BuildingType {
	// Industrial buildings
	/** The Solar Plants produce Energy */
	SOLAR_PLANT(BuildingCategory.INDUSTRIAL, "building.solar_plant", Input.KEY_S),

	/** The cristal mines produce Cristal */
	CRISTAL_MINE(BuildingCategory.INDUSTRIAL, "building.cristal_mine", Input.KEY_C),

	/** The farms produce food */
	BIO_FARM(BuildingCategory.INDUSTRIAL, "building.bio_farm", Input.KEY_B),

	/** The gas refineries produce fuel */
	GAS_REFINERY(BuildingCategory.INDUSTRIAL, "building.gas_refinery", Input.KEY_G),

	/** Warehouses increase the amount of storable ressources */
	WAREHOUSE(BuildingCategory.INDUSTRIAL, "building.warehouse", Input.KEY_W),

	/** Warehouses increase the amount of storable ressources */
	ROBOT_FACTORY(BuildingCategory.INDUSTRIAL, "building.robot_factory", Input.KEY_F),

	// Civil buildings
	/** 	 */
	COMMAND_CENTER(BuildingCategory.CIVIL, "building.command_center", -1),

	/**
	 * The research Center enable researching. Only one research center can be
	 * built
	 */
	RESEARCH_CENTER(BuildingCategory.CIVIL, "building.research_center", Input.KEY_S),

	/** Residences increase the amount of space for the inhabitants */
	// RESIDENCE(BuildingCategory.CIVIL, ""),

	// Military buildings
	/** Basic tower */
	LASER_TOWER(BuildingCategory.MILITARY, "", -1), // TODO

	/** Rail Tower */
	RAIL_TOWER(BuildingCategory.MILITARY, "", -1), // TODO

	// Landscape buildings
	ROAD(BuildingCategory.CIVIL, "building.road", Input.KEY_R), ;

	/** The building category */
	private BuildingCategory category;
	/** The i18n key*/
	private String i18nKey;
	/** The build shortcut */
	private int shortcut;

	private BuildingType(BuildingCategory category, String i18nKey, int shortcut) {
		this.category = category;
		this.i18nKey = i18nKey;
		this.shortcut = shortcut;
	}

	public BuildingCategory getCategory() {
		return this.category;
	}

	public static List<BuildingType> values(BuildingCategory cat) {
		List<BuildingType> types = new ArrayList<BuildingType>();
		for (BuildingType type : values()) {
			if (type.getCategory().equals(cat)) {
				types.add(type);
			}
		}
		return types;
	}

	public String getI18n() {
		return this.i18nKey;
	}
	
	public String getDescI18n(){
		return this.i18nKey + ".desc";
	}
	
	public int getShortcut(){
		return this.shortcut;
	}
}
